#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <linux/fb.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <disp_manager.h>
#include <font_manager.h>
#include <ui.h>


int main(int argc, char **argv)
{

    PDispBuffer ptBuffer;

    int err;
	Button tButton;
	Region tRegion;

    if(argc != 2)
    {
        printf("Usage:%s <fontfilename>\n",argv[0]);
        return -1;
    }


    DisPlayInit();

    SelectDefaultDisplay("fb");

    InitDefaultDisplay();

    ptBuffer = GetDispBuffer();

    FontOrpsRegisterInList();

    err = SelectAndInitFont ("Freetype",argv[1]);
    if(err)
    {
        printf("Select default font error\n");
        return -1;
    }

	tRegion.iLeftUpX = 200;
	tRegion.iLeftUpY = 200;
	tRegion.iHeigh   = 100;
	tRegion.iWidth   = 300;

	ButtonInit (&tButton,"text", &tRegion , NULL, NULL);
  
	tButton.OnDraw(&tButton , ptBuffer);
	//lcd_put_ascii(100, 100, 'A'); 

	while(1)
	{
		tButton.OnPress(&tButton , ptBuffer , NULL);
		sleep(2);
	}

	return 0;	
}

